package com.dhcc.bpm.common.utils;

import java.security.SecureRandom;
import java.util.Random;

/**
 * @ClassName RandomUtil
 * @Description 获取随机数
 * @Author xiafayu
 * @Date 2020/2/21 0021 15:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 **/
public class RandomUtil {
	
	/**
	 * 获取随机数
	 * @param startRange 开始范围
	 * @param endRange 结束范围
	 * @return
	 */
	public static long getRandomNumber(int startRange, int endRange) {
		Random random = new SecureRandom();;
		int randomNum = random.nextInt(endRange);
		if(randomNum < startRange) {
			randomNum += startRange;
		}
		return (long) randomNum;
		
	}

}
